<?php

namespace App\Http\Middleware;

use Closure;

class Owner
{

    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        //没有登录信息就跳转到登录页面

        if ((isset($_SESSION) && !empty($_SESSION)) && (isset($_SESSION['ownerpc'])) && !empty($_SESSION['ownerpc'])) {
            return $next($request);
        } else {
            return redirect(route('owner.ownerForm'));
        }


    }
}
